/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.graphics.chart.objects;

import java.util.ArrayList;
import org.charts.basic.ChartXY;
import javax.swing.JFrame;
import org.charts.advanced.ChartBar3D;
import org.charts.basic.ChartPie;
import org.charts.objects.PointXY;
import org.charts.container.ChartPane;

/**
 *
 * @author Katherine
 */
public class Example {
    
    public static void main(String [ ] a) {
      JFrame f = new JFrame("Grafico");
      f.setBounds(20, 20, 500, 400); f.setLayout(null);
      
      ChartPane g = new ChartPane();      
      
      g.insertChar(getChartBar3D());
      f.setContentPane(g); f.setVisible(true);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    
    public static ChartXY getChartXY() {  
      ChartXY xy = new ChartXY();
      
      ArrayList <PointXY> points = new ArrayList<>();
      for (double i = 0.0; i <= 10.0; i = i + 0.1) {
          PointXY point = new PointXY(i,Math.sin(i));
          points.add(point);
      }
      
      xy.addFunction("sen (x)", points);
      
      ArrayList <PointXY> points2 = new ArrayList<>();
      for(double i = 0.0; i <= 10.0; i = i + 0.1) {
        PointXY point = new PointXY(i,i);
          points2.add(point);
      }
      
      xy.addFunction("f (x)", points2);
      
      xy.createChart(); return xy;
    }
    
    public static ChartPie getChartPie() {  
        ChartPie chartPie = new ChartPie();
        
        chartPie.addValue("Tag1",1);
        chartPie.addValue("Tag2",2);
        chartPie.createChart();
        return chartPie;
    }
    
    public static ChartBar3D getChartBar3D() {  
        ChartBar3D chartPie = new ChartBar3D("DANIEL");
        
        chartPie.addValue(4, "Serie1", "Detalle");
        chartPie.addValue(2, "Serie2", "Detalle");
        chartPie.addValue(6, "Serie4", "Detalle");
        chartPie.createChart();
        return chartPie;
    }
}
